package com.example.push;


import android.app.Notification;
import android.content.Context;
import android.util.Log;

import cn.jpush.android.api.CmdMessage;
import cn.jpush.android.api.CustomMessage;
import cn.jpush.android.api.JPushMessage;
import cn.jpush.android.api.NotificationMessage;
import cn.jpush.android.service.JPushMessageReceiver;

public class MyJpushReceiver extends JPushMessageReceiver {
    private static final String TAG = MyJpushReceiver.class.getSimpleName();

    /**
     * 操作alias时调用
     */
    @Override
    public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
        super.onAliasOperatorResult(context, jPushMessage);
        Log.e(TAG, "onAliasOperatorResult======" + jPushMessage.toString());
    }

    @Override
    public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) {
        super.onCheckTagOperatorResult(context, jPushMessage);
        Log.e(TAG, "onCheckTagOperatorResult======" + jPushMessage.toString());
    }

    @Override
    public void onCommandResult(Context context, CmdMessage cmdMessage) {
        super.onCommandResult(context, cmdMessage);
        Log.e(TAG, "onCommandResult======" + cmdMessage.toString());
    }

    /**
     * 每次打开app建立连接调用
     */
    @Override
    public void onConnected(Context context, boolean b) {
        super.onConnected(context, b);
        Log.e(TAG, "onConnected======" + b);

    }

    /**
     * 消息
     */
    @Override
    public void onMessage(Context context, CustomMessage customMessage) {
        super.onMessage(context, customMessage);
        Log.e(TAG, "onMessage======" + customMessage.toString());

    }

    @Override
    public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
        super.onMobileNumberOperatorResult(context, jPushMessage);
        Log.e(TAG, "onMobileNumberOperatorResult======" + jPushMessage.toString());

    }

    /**
     * 通知，默认会有通知弹出
     */
    @Override
    public void onNotifyMessageArrived(Context context, NotificationMessage notificationMessage) {
        super.onNotifyMessageArrived(context, notificationMessage);
        Log.e(TAG, "onNotifyMessageArrived======" + notificationMessage.toString());

    }

    @Override
    public void onNotifyMessageDismiss(Context context, NotificationMessage notificationMessage) {
        super.onNotifyMessageDismiss(context, notificationMessage);
        Log.e(TAG, "onNotifyMessageDismiss======" + notificationMessage.toString());

    }

    @Override
    public void onNotifyMessageOpened(Context context, NotificationMessage notificationMessage) {
        super.onNotifyMessageOpened(context, notificationMessage);
        Log.e(TAG, "onNotifyMessageOpened======" + notificationMessage.toString());

    }

    /**
     * 注册只走一次
     *
     * @param s ： registrationID  值同：
     *          String registrationID = JPushInterface.getRegistrationID(MainActivity.this);
     */
    @Override
    public void onRegister(Context context, String s) {
        super.onRegister(context, s);
        Log.e(TAG, "onRegister======" + s);

    }

    @Override
    public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
        super.onTagOperatorResult(context, jPushMessage);
        Log.e(TAG, "onTagOperatorResult======" + jPushMessage.toString());

    }

    @Override
    public Notification getNotification(Context context, NotificationMessage notificationMessage) {
        Log.e(TAG, "getNotification======" + notificationMessage.toString());

        return super.getNotification(context, notificationMessage);
    }

}
